package demo_static;


class Student {
    public static int classroom = 310; //班级

    private String name; //姓名
    public void show() {
        System.out.println("嘻嘻");
    }
    public static void test() {
        System.out.println("哈哈");
        //通过对象的引用调用 √
        Student student = new Student();
        student.show();
        student.name = "小王";
        //直接调用 ×
        //name = "小王";
        //show();
    }

//    private int age; //年龄

    //    public Student(String name, int age) {
//        this.name = name;
//        this.age = age;
//    }

}
public class Test {
    public static void main(String[] args) {

    }


//    public static void main(String[] args) {
//        Student s1 = new Student("小王", 18);
//        Student s2 = new Student("小李", 17);
//        Student s3 = new Student("小刘", 19);
//        Student.classroom = 310;
//    }
}





//class Student {
//    private String name; //姓名
//    private int age; //年龄
//    public Student(String name, int age) {
//        this.name = name;
//        this.age = age;
//    }
//    public int classroom; //班级
//}
//public class Test {
//    public static void main(String[] args) {
//        Student s1 = new Student("小王", 18);
//        s1.classroom = 310;
//        Student s2 = new Student("小李", 17);
//        s2.classroom = 310;
//        Student s3 = new Student("小刘", 19);
//        s3.classroom = 310;
//    }
//}
